home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / Headers / CHRSModules.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-05  |  4.5 KB  |  180 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Program Name:    Stiletto                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        CHRSModules.h                                                                */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1991-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1991-09-28    Chris Halim            Original version                                        */
  15. /*        1995-06-26    Jaakko Railo        Version 2.0                                                */
  16. /*                                                                                                */
  17. /************************************************************************************************/
  18.  
  19. /****************************************** DESCRIPTION ******************************************
  20.  
  21. *************************************************************************************************/
  22.  
  23. /************************************************************************************************/
  24. /************************************************************************************************/
  25.  
  26.  
  27. #ifndef    __CHRSMODULES__
  28. #define    __CHRSMODULES__
  29.  
  30. #ifndef __TELEPHONES__
  31. #include "Telephones.h"
  32. #endif
  33.  
  34. #ifndef __LOGWINDOW__
  35. #include "LogWindow.h"
  36. #endif
  37.  
  38.  
  39. #define    kModuleType        'CHRS'
  40.  
  41. enum {
  42.     kModuleID = 128                        // resource ID for the CHRS module
  43. };
  44.     
  45. enum {
  46.     kTestModuleVersion = 3                // current version of CHRS format
  47. };
  48.  
  49. enum {
  50.     kWrongVersion =    -1                    // error code for running incompatible module
  51. };
  52.  
  53. enum {                                    // callback codes
  54.     getCurrentTELHandleRequest    = 1,
  55.     getCAHandleRequest            = 2,
  56.     getDNHandleRequest            = 3,
  57.     printRequest                = 4
  58. };
  59.  
  60. enum {                                    // result codes in CHRSBlock.result
  61.     requestSuccess             = 0,
  62.     requestFail                = 1,
  63.     requestNotImplemented    = 2
  64. };
  65.  
  66.  
  67. #if defined(powerc) || defined (__powerc)
  68. #pragma options align=mac68k
  69. #endif
  70. struct CHRSBlock {
  71. //    short                paramCount;            // XMOD
  72. //    Handle                params[16];            // XMOD
  73. //    Handle                returnValue;        // XMOD
  74. //    Boolean                passFlag;            // XMOD
  75.  
  76.     short                version;            // module version number NO XMOD
  77.     
  78.     UniversalProcPtr    entryPoint;            // call back to Stiletto
  79.     
  80.     short                request;            // code for call back function
  81.     short                result;                // result of calling back (succ, fail, etc.)
  82.     long                 inArgs[8];            // arguments sent by CHRS modules to Stiletto
  83.     long                 outArgs[4];            // answers returns by Stiletto
  84. };
  85. #if defined(powerc) || defined(__powerc)
  86. #pragma options align=reset
  87. #endif
  88.  
  89. typedef struct CHRSBlock CHRSBlock;
  90.  
  91. typedef CHRSBlock *CHRSPtr;
  92.  
  93.  
  94. typedef void (*EntryPointProcPtr) (CHRSPtr paramPtr);
  95.  
  96. #if GENERATINGCFM
  97. typedef UniversalProcPtr EntryPointUPP;
  98. #else
  99. typedef EntryPointProcPtr EntryPointUPP;
  100. #endif
  101.  
  102. enum {
  103.     uppEntryPointProcInfo = kCStackBased
  104.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(CHRSPtr)))
  105. };
  106.  
  107. #if GENERATINGCFM
  108. #define NewEntryPointProc(userRoutine)        \
  109.         (EntryPointUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEntryPointProcInfo, GetCurrentISA())
  110. #else
  111. #define NewEntryPointProc(userRoutine)        \
  112.         ((EntryPointUPP) (userRoutine))
  113. #endif
  114.  
  115. #if GENERATINGCFM
  116. #define CallEntryPointProc(userRoutine, paramPtr)        \
  117.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppEntryPointProcInfo, (paramPtr))
  118. #else
  119. #define CallEntryPointProc(userRoutine, paramPtr)        \
  120.         (*(userRoutine))((paramPtr))
  121. #endif
  122.  
  123.  
  124. #ifdef __cplusplus
  125. extern "C" {
  126. #endif    
  127.  
  128.  
  129. extern pascal TELHandle    GetCurrentTELHandle (CHRSPtr paramPtr);
  130.  
  131. /**
  132.  **        GetCurrentTELHandle will return the TELHandle currently used by
  133.  **        Stiletto.
  134.  **
  135.  **/
  136.  
  137. extern pascal TELCAHandle    GetCAHandle (CHRSPtr paramPtr);
  138.  
  139. /**
  140.  **        GetCAHandle will display a list of CAs currently in used. Users
  141.  **        will then pick a CA from this list.
  142.  **
  143.  **/
  144.  
  145. extern pascal TELDNHandle    GetDNHandle (CHRSPtr paramPtr);
  146.  
  147. /**
  148.  **        GetDNHandle will display a list of DNs currently in used. Users
  149.  **        will then pick a DN from this list.
  150.  **
  151.  **/
  152.  
  153. extern void Print (CHRSPtr paramPtr, const char * format, ...); 
  154.  
  155. /**
  156.  **        This is a call back routine to allow modules to print directly onto
  157.  **        the default log window of the host application. The format is similar
  158.  **        to C printf. Because of the nature of this routine, it cannot be called
  159.  **     from Pascal.
  160.  **
  161.  **/
  162.  
  163.  
  164. extern pascal Boolean StandardFilterProc(DialogPtr theDialog, EventRecord * theEvent, short * itemHit);
  165.  
  166. /**
  167.  **        This routine can be used as a ModalDialog filter proc. This filter
  168.  **        allows command-period and esc-key to be interpreted as a hit on item 2
  169.  **        (usually the cancel button)
  170.  **
  171.  **/
  172.  
  173.  
  174. #ifdef __cplusplus
  175. }
  176. #endif
  177.  
  178.  
  179. #endif
  180.